package com.yjhb.android.sbz.activity;

import android.content.Intent;

import com.yjhb.android.sbz.Conf;
import com.yjhb.android.sbz.R;
import com.yjhb.android.sbz.fragment.ChatFragment;
import com.jojo.android.zxlib.base.mvp.BasePresenter;
import com.tencent.qcloud.tim.uikit.modules.chat.base.ChatInfo;

/**
 * 创建者 zx
 * 创建时间 2020/12/23 18:04
 */
public class ChatActivity extends BaseActivity {
    private final String TAG = "ChatActivity";

    private ChatFragment chatFragment;
    private ChatInfo chatInfo;
    private int entrance; //入口 0消息界面，1任务详情，2任务审核,3联系客服,4举报维权,5进行中任务,6分享任务,7联系我们
    private String extraData;

    @Override
    protected BasePresenter initPresenter() {
        return null;
    }

    @Override
    protected int getLayoutId() {
        return R.layout.chat_activity;
    }

    @Override
    protected int getStatusBarResource() {
        return R.color.red_4040;
    }

    @Override
    protected boolean isImmerse() {
        return false;
    }

    @Override
    protected void initUI() {
        initUI(getIntent());
    }

    @Override
    protected void onNewIntent(Intent intent) {
        super.onNewIntent(intent);
        initUI(intent);
    }

    private void initUI(Intent intent){
        chatInfo = (ChatInfo) intent.getSerializableExtra(Conf.KEY_CHAT);
        entrance = intent.getIntExtra(Conf.KEY_ENTRANCE, 0);
        extraData = intent.getStringExtra(Conf.KEY_EXTRA_DATA);
        chatFragment = new ChatFragment();
        chatFragment.setChatInfo(chatInfo);
        chatFragment.setEntrance(entrance);
        chatFragment.setExtraData(extraData);
        getSupportFragmentManager()
                .beginTransaction()
                .replace(R.id.content_layout, chatFragment)
                .commit();
    }

    @Override
    protected void initData() {

    }

    @Override
    protected void regEvent() {

    }
}
